﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace Problem005
{
    class Program
    {
        private const int maxNumber = 20;
        private static readonly IEnumerable<int> range = Enumerable.Range(1, maxNumber);

        private static readonly Func<long, bool> isEvenlyDivisible = x =>
                                                   {
                                                       foreach (var divisor in range)
                                                       {
                                                           if (0 != x % divisor)
                                                               return false;
                                                       }

                                                       return true;
                                                   };

        static void Main()
        {
            var time = new Stopwatch();

            time.Start();
            for (long number = 10; number < long.MaxValue; number += 10)
            {
                if (isEvenlyDivisible(number))
                {
                    Console.WriteLine(number);
                    break;
                }
            }
            time.Stop();

            Console.WriteLine("Execution time: {0}ms", time.ElapsedMilliseconds);

            Console.ReadKey();
        }
    }
}
